import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { UserSubscribeVO, UserSubscribeForm, UserSubscribeQuery } from '@/api/business/userSubscribe/types';

/**
 * 查询用户私募认购记录列表
 * @param query
 * @returns {*}
 */

export const listUserSubscribe = (query?: UserSubscribeQuery): AxiosPromise<UserSubscribeVO[]> => {
  return request({
    url: '/business/userSubscribe/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询用户私募认购记录详细
 * @param id
 */
export const getUserSubscribe = (id: string | number): AxiosPromise<UserSubscribeVO> => {
  return request({
    url: '/business/userSubscribe/' + id,
    method: 'get'
  });
};

/**
 * 新增用户私募认购记录
 * @param data
 */
export const addUserSubscribe = (data: UserSubscribeForm) => {
  return request({
    url: '/business/userSubscribe',
    method: 'post',
    data: data
  });
};

/**
 * 修改用户私募认购记录
 * @param data
 */
export const updateUserSubscribe = (data: UserSubscribeForm) => {
  return request({
    url: '/business/userSubscribe',
    method: 'put',
    data: data
  });
};

/**
 * 删除用户私募认购记录
 * @param id
 */
export const delUserSubscribe = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/userSubscribe/' + id,
    method: 'delete'
  });
};
